# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @Project   :template 
# @FileName  :socket_ex2.py
# @Time      :2023/12/1 16:38
# @Author    :zxc19
# @IDE       :PyCharm
# @DESC      :
from locust import constant_throughput, task, run_single_user
from loguru import logger

from users.socket import UDPSocketAbstractUser


class UDPSyslogUser2(UDPSocketAbstractUser):
    wait_time = constant_throughput(1)
    host = '10.122.201.71'  # 目的主机地址

    def __init__(self, environment):
        super().__init__(environment)
        logger.debug(f'初始化用户:{self.__class__.__name__}')

    # 标记为任务
    @task
    def syslog(self):
        self.send(self.host, 514, '2222')


if __name__ == "__main__":
    run_single_user(UDPSyslogUser2)
